Default Region Qualifiers
The rules the compiler uses for filling in @region qualifiers when they are omitted from pointer types are a little complicated, but they are designed to avoid clutter in the common case:
- In function-argument types, a fresh (polymorphic) region name is used.
- In function-return types,
`H
is used. - In type definitions, including typedef,
`H
is used. - In function bodies, unification is used to infer the region based on how the location assigned the pointer type is used in the function.
Thus, be warned that
typedef int * foo_t;
void g(foo_t);
is different than
void g(int *);
The reason is clear when we fill in the default region qualifiers. In the first case, we have:
typedef int *@region(`H) foo_t;
void g(foo_t);
whereas in the second case we have:
void g(int *@region(`r));